package com.net.xpay.core.dao.safePay;

import com.net.xpay.core.domain.safePay.SafePayOrder;
import com.net.xpay.core.enums.SafePayOrderStatus;
import com.net.xpay.core.model.SafePayOrderSearchModel;
import com.net.common.annotation.DataShard;
import com.net.common.dao.Page;
import com.net.common.dao.VersionedMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@DataShard("")
@Repository
public interface SafePayOrderMapper extends VersionedMapper<Long, SafePayOrder> {
    int batchSave(@Param("orders") List<SafePayOrder> safePayOrders);

    int updateStatusByBatchId(@Param("userId") Long userId, @Param("batchId") Long batchId, @Param("status") SafePayOrderStatus status, @Param("free") Boolean free, @Param("endTime") LocalDateTime endTime);

    List<SafePayOrder> search(@Param("searchModel") SafePayOrderSearchModel searchModel, @Param("page") Page page);

    List<SafePayOrder> list(@Param("searchModel") SafePayOrderSearchModel searchModel);

    long searchCount(@Param("searchModel") SafePayOrderSearchModel searchModel);

    List<Long> listIds(@Param("searchModel") SafePayOrderSearchModel searchModel);

    long statSingleVeryCount(@Param("minEndTime") LocalDateTime minEndTime, @Param("maxEndTime") LocalDateTime maxEndTime,@Param("status") SafePayOrderStatus status);

    long statUserSingleVeryCount(@Param("userId") Long userId,@Param("minEndTime") LocalDateTime minEndTime, @Param("maxEndTime") LocalDateTime maxEndTime,@Param("status") SafePayOrderStatus status);

    long statSafePayTransPayeeAlipayAccount(@Param("minEndTime") LocalDateTime minEndTime, @Param("maxEndTime") LocalDateTime maxEndTime);


    long statUserLargeCount(@Param("userId") Long userId,@Param("minEndTime") LocalDateTime minEndTime, @Param("maxEndTime") LocalDateTime maxEndTime,@Param("status") SafePayOrderStatus status);
}
